package com.csun.cmny.provider.web.rpc;

import com.csun.cmny.core.support.BaseController;
import com.csun.cmny.provider.model.vo.OmcUserVo;
import com.csun.cmny.provider.service.OmcGroupFeignApi;
import com.csun.cmny.provider.service.OmcGroupService;
import com.csun.cmny.util.wrapper.WrapMapper;
import io.swagger.annotations.ApiOperation;
import com.csun.cmny.util.wrapper.Wrapper;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class OmcGroupFeignClient extends BaseController implements OmcGroupFeignApi {

    @Resource
    private OmcGroupService omcGroupService;

    @ApiOperation(httpMethod = "POST", value = "删除护工的护工组关系")
    public Wrapper deleteNursingUserBind(Long userId) {
        if (userId == null){
            return  WrapMapper.wrap(Wrapper.ILLEGAL_ARGUMENT_CODE_,"老人id不能为空",null);
        }
        int ret = omcGroupService.deleteNursingUserBind(userId);
        return WrapMapper.ok(ret);
    }

    public Wrapper<OmcUserVo> getUserNursingGroupInfo(Long userId) {
        if (userId == null){
            return  WrapMapper.wrap(Wrapper.ILLEGAL_ARGUMENT_CODE_,"老人id不能为空",null);
        }
        OmcUserVo ret = omcGroupService.getUserNursingGroupInfo(userId);
        return WrapMapper.ok(ret);
    }
}
